Skip to content

feat(viewer): inline comment threads in a popover on narrow screens#562

Merged
yumike merged 1 commit into
mainfrom
narrow-comment-popover
Jun 22, 2026
Merged

feat(viewer): inline comment threads in a popover on narrow screens#562
yumike merged 1 commit into
mainfrom
narrow-comment-popover

Conversation

@yumike

@yumike yumike commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Below the 952px container-query breakpoint the right-margin comment column is hidden, so tapping a highlighted passage previously did nothing — inline-comment threads were unreachable on narrow windows and phones. This surfaces them in a popover.

What changed

  • Shared CommentPanel extracted from CommentSidebar (a pin prop gates the margin-column padding/visibility pinning), wrapped by both the wide aside and the new CommentPopover.
  • narrow layout signal from a ResizeObserver on the layout container (the pattern Breadcrumbs already uses), gating aside-vs-popover so the panel mounts in exactly one place.
  • CommentPopover — a free-mode Popover anchored to the highlight in article coordinates: fixed 288px width (matching the sidebar card), centered on the highlight and clamped on-screen, with a gap below it at the page bottom.
  • Dismissal handled in-component so it can exempt highlight clicks (tap another highlight to switch, not close) and defer Escape to CommentForm (blur the reply/draft field, including mid-IME-composition, instead of tearing down the thread). Labelled role="group" "Comments" — non-modal, no over-promised dialog focus semantics.
  • View / reply / resolve / delete, compose-new, n/p navigation, and the r focus-reply shortcut + per-thread reply drafts all work in the popover.

Tests

  • Unit tests for the breakpoint and clamp helpers.
  • Playwright e2e: open, dismiss (Escape / outside-click / IME), compose, switch, n/p, r, reply-draft persistence, and the wide-screen control.
  • 580 unit + 11 e2e pass; svelte-check clean.

🤖 Generated with Claude Code

Below the 952px container-query breakpoint the right-margin comment column is
hidden, so tapping a highlighted passage previously did nothing — inline-comment
threads were unreachable on narrow windows and phones. This adds a popover that
surfaces them there.

- Extract a shared CommentPanel from CommentSidebar (a `pin` prop gates the
  margin-column padding/visibility pinning), wrapped by the wide aside and the
  new CommentPopover.
- Track a `narrow` layout signal from a ResizeObserver on the layout container
  (the pattern Breadcrumbs already uses), gating the aside vs the popover so the
  same panel mounts in exactly one place.
- CommentPopover: a free-mode Popover anchored to the highlight in article
  coordinates — fixed 288px width (matching the sidebar card), centered on the
  highlight and clamped on-screen, with a gap below it at the page bottom.
- Dismissal handled in-component so it can exempt highlight clicks (tap another
  highlight to switch, not close) and defer Escape to CommentForm (blur the
  reply/draft field, including mid-IME-composition, instead of tearing down the
  thread). Labelled role="group" "Comments" (non-modal; no over-promised dialog
  focus semantics).
- View/reply/resolve/delete, compose-new, n/p navigation, and the r focus-reply
  shortcut + per-thread reply drafts all work in the popover.

Unit tests for the breakpoint and clamp helpers; Playwright e2e covering open,
dismiss, compose, switch, n/p, r, reply-draft persistence, and the wide-screen
control. svelte-check clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@yumike yumike merged commit d770961 into main Jun 22, 2026
18 checks passed
@yumike yumike deleted the narrow-comment-popover branch June 22, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant